package com.cskaoyan.bean.vo.vxVo;

import com.cskaoyan.bean.po.wxPo.MarketComment;
import com.cskaoyan.bean.po.wxPo.MarketUser;
import com.cskaoyan.util.StringToArrayUtils;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;
import java.util.List;

@NoArgsConstructor
@Data
public class WxGoodsCommentDataVO {
    private Date addTime;
    private List<String> picList;
    private String adminContent;
    private String nickname;
    private Integer id;
    private String avatar;
    private String content;

    public static WxGoodsCommentDataVO getWxGoodsCommentDataVO(MarketComment marketComment, MarketUser marketUser){
        WxGoodsCommentDataVO wxGoodsCommentDataVO = new WxGoodsCommentDataVO();
        wxGoodsCommentDataVO.setAddTime(marketComment.getAddTime());
        wxGoodsCommentDataVO.setAdminContent(marketComment.getAdminContent());
        wxGoodsCommentDataVO.setNickname(marketUser.getNickname());
        wxGoodsCommentDataVO.setId(marketComment.getId());
        wxGoodsCommentDataVO.setAvatar(marketUser.getAvatar());
        wxGoodsCommentDataVO.setContent(marketComment.getContent());
        String picUrls = marketComment.getPicUrls();
        List<String> stringList = StringToArrayUtils.toStringList(picUrls);
        wxGoodsCommentDataVO.setPicList(stringList);
        return wxGoodsCommentDataVO;
    }
}
